<?xml version="1" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
  <head>
    <title>Translit in JavaScript</title>
    <link rel="stylesheet" href="rubrika.css" media="all" type="text/css" />
    <script type="text/javascript" src="translit.js"></script>
  </head>
  <body onload=''>

      <script>
        var data = [
             "WebРазработка/Мимо",
 "Смотрите зайцы -- нас много",
 "Привет, Родина!",
 "ЙухХа",
 "Ыхыхых It's English text",
 "Пьянь",
 "(){}----____",
 "Madonna - Свежия Песенки",
 "5+8-4=9",
 "Въезд ГЛЯНЬ, ВЪЕЗД",
 "Установка mod_perl",
 "Проверка__двери неразумной",
 "Проверка_ дверцы",
 "Кровать устала _ь",
 "test__bed",
 "test_ bed",
 "test__ __bed",
 "a_-_b-_-c",
 "a - b _ c",
                   ];
var Translit1 = new Translit();

document.write( "<h2>UrlTranslit</h2>" );
for (var i in data)
{
  document.write("'"+data[i]+"' <font color=gray>becomes</font> '"+Translit1.UrlTranslit(data[i], 1)+"'<br>");
}

document.write( "<h2>Supertag</h2>" );
for (var i in data)
{
  document.write("'"+data[i]+"' <font color=gray>becomes</font> '"+
    (tr = Translit1.Supertag(data[i], 1))+"'. <font color=gray>Supertag(UrlTranslit)==Supertag</font> "+
    ((tr==Translit1.Supertag(Translit1.UrlTranslit(data[i], 1), 1))?"<font color=green>pass</font>":"<font color=red>fail</font>")+
    "<br>");
}

document.write( "<h2>BiDi</h2>" );
//document.write( "<font color=red>This method is not available yet</font>" );
var slash = '';

for (var i in data)
{
  str = data[i].replace( new RegExp( "[^"+slash+"0-9a-zA-Z\\- _а-яА-ЯёЁ]+", "g"), "");
  document.write("'"+str+"' <font color=gray>becomes</font> '"+
    (tr = Translit1.BiDiTranslit(str, 0, 1))+"' <font color=gray>then</font> '"+
    (retr = Translit1.BiDiTranslit(tr, 1, 1))+"', <font color=gray>and it</font> "+ 
    ((str==retr)?"<font color=green>pass</font>":"<font color=red>fail</font>")+
    "<br>");
}
      </script>
   
  </body>
</html>
